<template>
	<view>
		<!-- 		<view style="width: 100%; ">
			<u--image src="/static/bg_login.png" ></u--image>
		</view> -->
		<u--text color="red" text="注:提现请输入支付宝或者注册微信手机号" :bold="true" customStyle="margin: 50px 0px 0px 50rpx"></u--text>
		
		<u--text text="提现金额" :bold="true" customStyle="margin: 50px 0px 0px 50rpx"></u--text>
		<u--input v-model="nameValue" customStyle="margin: 10px 50px 0px 50rpx" placeholder="请输入提现金额" border="bottom"
			clearable>
		</u--input>

		<u--text text="支付收款宝账号" :bold="true" customStyle="margin: 30px 0px 0px 50rpx"></u--text>
		<u--input v-model="zfbValue" customStyle="margin: 10px 50px 0px 50rpx" placeholder="支付收款宝账号" border="bottom"
			clearable>
		</u--input>
		
		
		<u--text text="微信收款账号" :bold="true" customStyle="margin: 30px 0px 0px 50rpx"></u--text>
		<u--input v-model="wxValue" customStyle="margin: 10px 50px 0px 50rpx" placeholder="请输入微信收款账号" border="bottom"
			clearable>
		</u--input>

		<view>
			<u-button class="custom-style" type="primary" text="申请提现" @click="clickLogin"></u-button>
		</view>
		<view v-if="0">
			<u-button class="custom-style-register" type="info" text="前去注册" @click="clickRegister"></u-button>
		</view>

		

	</view>
</template>

<script>
	export default {
		data() {
			return {
				nameValue: '',
				zfbValue: '',
				wxValue: '',
			}
		},
		methods: {
			
			clickLogin() {
				let type = 1;
				let account = 0;
				if((this.nameValue == '' || this.nameValue == undefined) ){
					this.$u.toast("请先填写提现金额!")
					return
				}
				if((this.zfbValue == '' || this.zfbValue == undefined) &&
				(this.wxValue == '' || this.wxValue == undefined)){
					this.$u.toast("请先填写资料!")
					return
				}
				account = this.zfbValue;
				if((this.zfbValue == '' || this.zfbValue == undefined)){
					type = 2;
					account = this.wxValue;
				}
				let param = {
					price: this.nameValue,
					paymentType: type,
					paymentAccount: account,
				}
				
				this.$u.api.apiWithDraw(param).then(res => {
					if (res.code == 1) {
						this.$u.toast("申请成功!")
					}else {
						this.$u.toast(res.msg)
					}
				})
			},
			clickRegister() {
				uni.$u.route({
					url: 'pages/login/register',
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.custom-style {
		width: 80%;
		margin-top: 100rpx;
	}

	.custom-style-register {
		width: 80%;
		margin-top: 50rpx;
	}
</style>